# タグ取得APIクラス

require "rb/api.rb"
require "rb/lib/json.rb"

$KCODE = "UTF"

class GetTagsAPI < API

    def initialize
        super
        print tags_by_jsonp()
    end

    def tags_by_jsonp
        json_str = ""
        if check_auth() then
            json_str = JsonBuilder.new.build(get_tags().sort())
        else
            json_str = "[]";
        end
        return attach_callback(json_str)
    end

    def attach_callback(json_str)
        return 'Obm.getTagsAPICallBack(' + json_str + ');'
    end
end

